package com.example.wac.enums;

/**
 * @author wuancheng
 * @description
 * @date 2022-07-25 17:53:00
 */

@SuppressWarnings("all")
public enum WeChatUrlEnum {
    /**
     * 获取access_token(公众号的core_token)
     */
    GET_ACCESS_TOKEN("获取access_token", "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={appSecret}"),
    /**
     * 获取微信用户信息
     */
    GET_USER_INFO("获取用户信息","https://api.weixin.qq.com/cgi-bin/user/info?access_token={access_token}&openid={openid}&lang=zh_CN"),

    /**
     * 获取access_token和openid
     */
    GET_ACCESS_TOKEN_BY_AUTHORIZE("获取access_token", "https://api.weixin.qq.com/sns/oauth2/access_token?appid={appid}&secret={appSecret}&code={code}&grant_type=authorization_code"),
    /**
     * 获取微信用户信息（需授权）
     */
    GET_USER_INFO_BY_AUTHORIZE("授权后获取用户信息","https://api.weixin.qq.com/sns/userinfo?access_token={access_token}&openid={openid}&lang=zh_CN"),

    /**
     * 发送模板消息
     */
    SEND_TEMPLATE_MESSAGE("发送模板消息","https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={access_token}"),

    ;
    WeChatUrlEnum(String name, String url) {
        this.name = name;
        this.url = url;
    }

    private String name;

    private String url;

    public String nameValue() {
        return this.name;
    }

    public String urlValue() {
        return this.url;
    }
}
